<template>
	<div style="border-radius: 5px; padding: 20px;">
		<el-form size="small">
			<el-form-item>
				<el-button type="success" @click="showCurrentLog()">查看当前日志</el-button>
			</el-form-item>
		</el-form>
		
		<el-table :data="tableData" border style="margin-top: 10px;">
			<el-table-column type="index" width="100" label="序号">
			</el-table-column>
			<el-table-column prop="logName" label="日志名称" align="center" header-align="center">
			</el-table-column>
			<el-table-column label="操作" align="center" width="120">
				<template slot-scope="scope">
					<el-button @click="showLog(scope.row.logName)" type="text" size="small">查看</el-button>
				</template>
			</el-table-column>
		</el-table>
		<showLog v-if="showLogVisible" ref="showLog"></showLog>
	</div>
</template>

<script>
	import {
		getSysLog,getSysLogList
	} from '@/api/system/sysLog/sysLog.js'
	import showLog from './showLog'
	export default {
		created: function() {
	
		},
		components:{
			showLog
		},
		filters: {
			
		},
		mounted: function() {
			this.getSysLogLists();
		},
		data() {
			return {
				show:'',
				tableData:[],
				showLogVisible:false
			}
		},
		methods: {
			getSysLogLists(){
				getSysLogList().then(data=>{
          if(data.code=='0000'){
            this.tableData = data.data
          }else{
            this.$message.error(data.msg)
          }
				})
			},
			showLog(logName){
				this.showLogVisible = true
				this.$nextTick(function(){
					this.$refs.showLog.init(logName)
				})
			},
			showCurrentLog(){
				this.showLogVisible = true
				this.$nextTick(function(){
					this.$refs.showLog.init('')
				})
			}
		}
	}
</script>

<style>
</style>
